Skip to content

fix(tooltip): fix wrong initial and focus tooltip positions in followMouse mode#1278

Open
bmichalowski wants to merge 2 commits intocanonical:mainfrom
bmichalowski:bug/tooltip-wrong-initial-position
Open

fix(tooltip): fix wrong initial and focus tooltip positions in followMouse mode#1278
bmichalowski wants to merge 2 commits intocanonical:mainfrom
bmichalowski:bug/tooltip-wrong-initial-position

Conversation

@bmichalowski
Copy link

@bmichalowski bmichalowski commented Nov 21, 2025

Done

The tooltip did not handle the initial position correctly in followMouse mode.
There was also an issue with listening to mouse move events only when the tooltip was open.

QA

Pinging @canonical/react-library-maintainers for a review.

tooltip_follow-mouse-mode_missing-tooltip-on-focus
tooltip_follow-mouse-mode_prev-posirion-bug

QA steps

Bug 1: Tooltip is not visible on keyboard focus in followMouse mode

  1. Given the tooltip is in followMouse mode
  2. And the user has focused the element with the tooltip using the TAB key
  3. When the element receives focus
  4. Then the tooltip should be visible

Bug 2: Tooltip appears at previous cursor location instead of current

  1. Given the tooltip is in followMouse mode
  2. And the user hovers over an element on the left side
  3. And then moves the cursor away from the element
  4. When the user hovers over an element on the right side
  5. Then the tooltip should appear next to the current cursor position
  6. And not at the previous location

Percy steps

No visual changes expected

@webteam-app
Copy link

bmichalowski is not a collaborator of the repo

@bmichalowski
Copy link
Author

@canonical/react-library-maintainers please take a look at the proposed changes

Copy link
Contributor

@edlerd edlerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution. This is an improved handling of the follow mouse mode indeed!

Some small nitpicks on formatting below, then this LGTM to merge.

@edlerd
Copy link
Contributor

edlerd commented Dec 10, 2025

Please stash all your commits with the formatting changes into one for a clean history.

@edlerd
Copy link
Contributor

edlerd commented Dec 10, 2025

Also, please rebase on the main branch to pull in recent updates.

@bartaz
Copy link
Member

bartaz commented Feb 26, 2026

@bmichalowski Are you interested in continuing working on the issue?

fix(tooltip): listen to mousemove event also for closed tooltip

test(tooltip): add visibility tests for followMouse case

test(tooltip): remove unnecessary followMouse flag from test

fix(tooltip): pr changes
@bmichalowski bmichalowski force-pushed the bug/tooltip-wrong-initial-position branch from ba362c1 to 707cb88 Compare February 27, 2026 15:00
@bmichalowski
Copy link
Author

@bartaz Yes, I'd be happy to finish it. However, I need a helping hand with Percey. Visually, nothing changes, so I think it should be marked as non-required. However, it starts and crashes during execution.

@bmichalowski bmichalowski requested a review from edlerd February 28, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants